<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>驻职院后台管理平台</title>
  <link rel="stylesheet" href="css/login.css">
  <link rel="stylesheet" type="text/css" href="layui/css/layui.css"/>
 <script type="text/javascript" src="layui/layui.js"></script>
</head>
<body class="login-bg">
    <canvas id="fullstarbg">你的浏览器不支持canvas标签</canvas>
    <div class="login">
        <div class="message">驻职院后台管理平台登录</div>
        <div id="darkbannerwrap"></div>   
        <form method="post" class="layui-form" id="loginform" >
            <input name="name" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input name="code" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
            <hr class="hr20" >
        </form>
    </div>
    <script>
    	layui.use(['form','layer','jquery'],function(){
    		var form=layui.form;
    		var layer=layui.layer;
    		var $=layui.jquery;
    		form.on('submit(login)', function(data){
						var str=$("#loginform").serialize();
					  $.post('http://localhost:8080/XXX/UserAdminServlet?reqName=login',str,function(res){
					  	if(res.success){
					  		layer.msg("登陆成功");
					  		window.setInterval(function(){
					  				window.location="admin.jsp";
					  		},2000);
					  	
					  	}else{
					  		layer.alert(res.message);
					  	}
					  },"json");
					  return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
					});
    	})
            

        </script>

    
    <!-- 底部结束 -->
    
</body>
</html>